class Province:
    def __init__(self, name):
        self.name = name
        print(f"{self.name}对象被分配")

    def __del__(self):
        print(f"{self.name}对象被释放")


# 创建对象
beijing = Province("北京")

# 当beijing变量超出作用域或被重新赋值时，对象将被销毁
beijing = None
